﻿@model DNA.Mvc.WebPage
@if (Model != null)
{
    var webname = WebSiteContext.Current.Web.Name;
    <table class="d-field-table">
        <tr>
            <td style="width: 80px;">
                Url:
            </td>
            <td>
                @if (string.IsNullOrEmpty(Model.LinkUrl))
                {
                    <a href="@UrlResolver.Resolve(Model)" class="d-link" target="_blank">
                        @UrlResolver.Resolve(Model)</a>
                }
                else
                {
                    <a href="@Model.LinkUrl" class="d-link" target="_blank">
                        @Model.LinkUrl</a>
                }
            </td>
        </tr>
        <tr>
            <td>
                @Html.Global("RES_TITLE"):
            </td>
            <td>
                <div style="white-space: normal;">
                    @GE.GetContent(Model.Title)</div>
            </td>
        </tr>
        <tr>
            <td>
                @Html.Global("RES_DESC"):
            </td>
            <td>
                <div style="white-space:normal;max-width:350px;overflow:hidden" title="@Model.Description">
                    @GE.GetContent(Model.Description)
                </div>
            </td>
        </tr>
        <tr>
            <td>
                @Html.Global("RES_DATE_CEATED"):
            </td>
            <td>
                @Html.Global(Model.Created)
            </td>
        </tr>
        <tr>
            <td>
                @Html.Global("RES_LASTUPDATED"):
            </td>
            <td>
                @Html.Global(Model.LastModified)
            </td>
        </tr>
        <tr>
            <td>
                @Html.Global("RES_ALLOW_PERSONLIZIATION"):
            </td>
            <td>
                @if (Model.AllowAnonymous)
                {
                    @:All
               }
                else
                { 
                    @string.Join(",", Model.Roles.Select(r => r.RoleName).ToArray()) 
                }
            </td>
        </tr>
        <tr>
            <td colspan="2" style="background: none; text-align: center;">
                @{
                Ajax.Dna().Button("btnDesignPage" + Model.ID.ToString())
                                .LocText("RES_DESIGN_PAGE")
                                .ImageIcons(Url.Content("~/Content/Images/design_content.gif"))
                                .Click("javascript:window.location='" + Url.Content(Model.Path) + "?design=true&returnUrl=" + Url.Content(Model.Path) + "';void(0);")
                                .Render();

                Ajax.Dna().Button("btnEditPage" + Model.ID.ToString())
                .LocText("RES_EDIT")

                .Click("location=\"" + Url.Action("Edit", "DynamicUI", new { Area = "", website = webname, id = Model.ID, returnUrl = Url.Action("PageManager", "DynamicUI") }) + "\";")
                .ImageIcons(Url.Content("~/content/images/edit_page.png"))
                .Render();

                Ajax.Dna().Button("btnImportPageData" + Model.ID.ToString())
                    .LocText("RES_IMPORT")
                    .ImageIcons(Url.Content("~/content/images/icon_upload_16.gif"))
                    .Render();

                Ajax.Dna().Uploader("btnImportPageData" + Model.ID.ToString())
                    .Upload(Url.Action("Import", "DynamicUI", new { Area = "", website = webname, id = Model.ID }))
                    .Render();

                Ajax.Dna().Button("btnExportPageData" + Model.ID.ToString())
                    .LocText("RES_EXPORT")
                    .Click("window.open(\"" + Url.Action("Export", "DynamicUI", new { Area = "", website = webname, id = Model.ID }) + "\");")
                    .ImageIcons(Url.Content("~/content/images/icon_download_16.gif"))
                    .Render();
                }
            </td>
        </tr>
    </table>
}
@Html.StartupScripts()
